package itsm.isperp.workflow.engine.identity.persistence;

import itsm.isperp.framework.service.IUserService;

import java.util.List;

import org.activiti.engine.identity.Group;
import org.activiti.engine.identity.User;
import org.activiti.engine.identity.UserQuery;
import org.activiti.engine.impl.Page;
import org.activiti.engine.impl.UserQueryImpl;
import org.activiti.engine.impl.persistence.entity.IdentityInfoEntity;
import org.activiti.engine.impl.persistence.entity.UserEntity;
import org.activiti.engine.impl.persistence.entity.UserEntityManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 
 * 
 * @author lizx
 * @date 2013-3-7
 */
@Service
public class ActivitiUserManager extends UserEntityManager {

	@Autowired
	protected IUserService userService;

	@Override
	public UserEntity findUserById(String userId) {
		return (UserEntity) userService.findByUsername(userId);
	}

	@Override
	public List<Group> findGroupsByUser(String userId) {
		return userService.findMemberRoleEntityByUsername(userId);
	}

	@Override
	public User createNewUser(String userId) {
		throw new UnsupportedOperationException("此功能已被屏蔽");
	}

	@Override
	public void insertUser(User user) {
		throw new UnsupportedOperationException("此功能已被屏蔽");
	}

	@Override
	public void deleteUser(String userId) {
		throw new UnsupportedOperationException("此功能已被屏蔽");
	}

	@Override
	public UserQuery createNewUserQuery() {
		return super.createNewUserQuery();
	}

	@Override
	public List<User> findUserByQueryCriteria(UserQueryImpl query, Page page) {
		throw new UnsupportedOperationException("此功能已被屏蔽");
	}

	@Override
	public long findUserCountByQueryCriteria(UserQueryImpl query) {
		throw new UnsupportedOperationException("此功能已被屏蔽");
	}

	@Override
	public IdentityInfoEntity findUserInfoByUserIdAndKey(String userId,
			String key) {
		throw new UnsupportedOperationException("此功能已被屏蔽");
	}

	@Override
	public List<String> findUserInfoKeysByUserIdAndType(String userId,
			String type) {
		throw new UnsupportedOperationException("此功能已被屏蔽");
	}

}
